package com.cy.pj.goods.service.impl;

import com.cy.pj.goods.dao.GoodsDao;
import com.cy.pj.goods.pojo.Goods;
import com.cy.pj.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsDao goodsDao;

    @Override
    public List<Goods> findGoods() {
        List<Goods> list = goodsDao.findGoods();

        return list;
    }

    @Override
    public int deleteById(Integer id) {
        int rows = goodsDao.deleteById(id);
        return rows;
    }

    @Override
    public int insertGoods(Goods goods) {
        int rows = goodsDao.insertGoods(goods);
        return rows;
    }

    @Override
    public Goods findById(Integer id) {

        return goodsDao.findById(id);
    }

    @Override
    public void updateGoods(Goods goods) {
        goodsDao.updateGoods(goods);
    }

    @Override
    public List<Goods> findObject(String name) {
        List<Goods> list = goodsDao.findObject(name);

        return list;
    }
}
